<script>

    //打印

    $('report').addEvent('click', function () {

        var begin_date = $('begin_date').get('value');
        var begin_date_objh = document.getElementsByName("_DTIME_[H][begin_date]")[0];
        var begin_date_h = begin_date_objh.options[begin_date_objh.selectedIndex].value;
        var begin_date_objm = document.getElementsByName("_DTIME_[M][begin_date]")[0];
        var begin_date_m = begin_date_objm.options[begin_date_objm.selectedIndex].value;
        begin_date = begin_date + " " + begin_date_h + ":" + begin_date_m+":00";

        var end_date = $('end_date').get('value');
        var end_date_objh = document.getElementsByName("_DTIME_[H][end_date]")[0];
        var end_date_h = end_date_objh.options[end_date_objh.selectedIndex].value;
        var end_date_objm = document.getElementsByName("_DTIME_[M][end_date]")[0];
        var end_date_m = end_date_objm.options[end_date_objm.selectedIndex].value;
        end_date = end_date + " " + end_date_h + ":" + end_date_m+":00";
        
        var orderform_bn = $('orderform_bn').get('value');
        var pickinglist_bn = $('pickinglist_bn').get('value');
        var logi_name = $('logi_name').get('value');
        var name=$('name').get('value');
        var url = "index.php?app=omeanalysts&ctl=analysis_orderformreport&act=report_order";
        url += '&orderform_bn=' + orderform_bn +'&pickinglist_bn=' + pickinglist_bn +'&logi_name=' + logi_name +'&name=' + name +'&begin_date=' + begin_date + '&end_date=' + end_date;
        window.open(url); 

    });

</script>

<div class="tableform"> 
     <h3>备货汇总报表</h3>



<form id="Searchform" action="index.php?app=omeanalysts&ctl=analysis_orderformreport&act=index" method="post">

    <div class="division">

        <table width='100%' cellspacing="0" cellpadding="0" >
              <tr>
                    <td>
                        快递：
                        <select name="logi_name" id="logi_name">
                            <option value="">全部</option>
                            <{foreach from=$loginameList key=key item=val}>
                            <option value="<{$val.logi_name}>" <{if $val.logi_name ==$clearingtable.logi_name }>selected<{/if}>  >
                            <{$val.logi_name}>
                            </option>
                            <{/foreach}>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        仓库：
                        <select name="name" id="name">
                            <option value="">全部</option>
                            <{foreach from=$branchnameList key=key item=val}>
                            <option value="<{$val.name}>" <{if $val.name ==$clearingtable.name }>selected<{/if}>  >
                            <{$val.name}>
                            </option>
                            <{/foreach}>
                        </select>
                    </td>
                </tr>

             <tr>
               <td>
                查询日期：
                <{input type="time" name="begin_date" vtype="required" id="begin_date" value="{$clearingtable.begin_date}" }>
                至：<{input type="time" value="{$clearingtable.end_date}"  id="end_date"  name="end_date"}>
                <span class="red">该时间分别为审批单修改时间、备货通知单修改时间!</span>
                </td>
              </tr>
             <tr>
               <td>
                备货单号：<{input type="text" name="orderform_bn" id="orderform_bn" value="{$clearingtable.orderform_bn}"}>
                </td>
              </tr>
              <tr>
                <td>
                审批单号：<{input type="text" name="pickinglist_bn" id="pickinglist_bn" value="{$clearingtable.pickinglist_bn}"}>
                <{button class="btn btn-primary" type="submit" id="saveCurrent" label="查询"}>
                 <{button class="btn btn-primary" type="button" id="report" label="导出"}>
                </td>
              </tr>


        </table>

   </div>

</form>



<div id="accordion" style="width:600px;">



            <b>按客户统计：</b>

        <table width="600px" cellspacing="0" cellpadding="0" class="gridlist">

            <thead>

            <tr>

                <th>客户名称</th>

                <th>料品</th>

                <th>快递</th>

                <th>仓库</th>

                <th>件数</th>

                <th>体积汇总</th>

            </tr>

            </thead>



            <{assign var="key" value="0"}>

            <{assign var="allvolume" value="0"}>

              <{foreach from=$comp_data item=his}>

            <{assign var="key" value=$key+$his.qty }>

            <{assign var="allvolume" value=$allvolume+$his.tovolume }>

              <tbody>

                <tr>

                  <td><{$his.customername}></td>
                  
                  <td><{$his.material_bn}></td>

                  <td><{$his.logi_name}></td>

                  <td><{$his.name}></td>

                  <td><{$his.qty}></td>

                  <td><{$his.tovolume}></td>

                </tr>

                </tbody>

              <{/foreach}>

                <tr>

                 
                 <td colspan="4"><b style="font-size:12px;color:red;">总数：</b></td>

                  <td><b style="font-size:12px;color:red;"><{$key}></b></td>

                  <td><b style="font-size:12px;color:red;"><{$allvolume}></b></td>

                </tr>

        </table>
<!--
            <br>

            <b>按快递统计：</b>

              <table width="300" cellspacing="0" cellpadding="0" class="gridlist">

            <thead>

            <tr>

                <th>快递名称</th>

                <th>件数</th>

                <th>体积汇总</th>

            </tr>

            </thead>



            <{assign var="key1" value="0"}>

            <{assign var="allvolume1" value="0"}>

            <{foreach from=$logi_data item=his}>

            <{assign var="key1" value=$key1+$his.qty }>

            <{assign var="allvolume1" value=$allvolume1+$his.tovolume }>

              <tbody>

                <tr>

                  <td><{$his.logi_name}></td>

                  <td><{$his.qty}></td>

                  <td><{$his.tovolume}></td>

                </tr>

                </tbody>

              <{/foreach}>

                <tr>

                  <td><b style="font-size:12px;color:red;">总数：</b></td>

                  <td><b style="font-size:12px;color:red;"><{$key1}></b></td>

                  <td><b style="font-size:12px;color:red;"><{$allvolume1}></b></td>

                </tr>

        </table>
-->
   </div>

   

 </div>

